home *** CD-ROM | disk | FTP | other *** search
- // Point at - Version 1.1
-
- // This script makes the layer in popup 1 point at the layer in popup 2
- // by setting rotation keyframes so that the y-axis of the layer
- // selected in popup 1 always points towards the center of the
- // layer selected in popup 2.
-
- // LAYER PROPERTY CHANNEL
- // ------ ---------- --------
- // 1: Layer you want to be the pointer doesn't matter doesn't matter
- // 2: Layer to point at doesn't matter doesn't matter
-
- delta = value(pop_layer(1), position) - value(pop_layer(2), position);
-
- // Compute the angle corresponding to the vector between layer 1 and layer 2
- // Subtracts 90, so y-axis point at object rather than x-axis
- ang = rad_to_deg(atan2(delta[Y], delta[X])) - 90;
-
- value(pop_layer(1), rotation) = ang;
-